home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / do-eve1r / lightmod.bas < prev    next >
BASIC Source File  |  1999-07-13  |  1KB  |  65 lines

  1. Attribute VB_Name = "Module1"
  2.  
  3. Global ip As String
  4. Public Sub SaveListBox(TheList As ListBox, Directory As String)
  5.  
  6.     Dim SaveList As Long
  7.     On Error Resume Next
  8.     Open Directory$ For Output As #1
  9.  
  10.  
  11.     For SaveList& = 0 To TheList.ListCount - 1
  12.         Print #1, TheList.List(SaveList&)
  13.     Next SaveList&
  14.  
  15.     Close #1
  16. End Sub
  17.  
  18. 'Example: Call LoadListBox(list1, "C:\Temp\MyList.dat")
  19.  
  20.  
  21. Public Sub LoadListBox(TheList As ListBox, Directory As String)
  22.  
  23.     Dim MyString As String
  24.     On Error Resume Next
  25.     Open Directory$ For Input As #1
  26.  
  27.  
  28.     While Not EOF(1)
  29.         Input #1, MyString$
  30.  
  31.  
  32.         DoEvents
  33.             TheList.AddItem MyString$
  34.         Wend
  35.  
  36.         Close #1
  37.         
  38.     End Sub
  39.  
  40.  
  41.  
  42. Public Sub PrintListBox(TheList As ListBox)
  43.  
  44.     Dim SaveList As Long
  45.     On Error Resume Next
  46.     Printer.FontSize = 12
  47.  
  48.  
  49.     For SaveList& = 0 To TheList.ListCount - 1
  50.         Printer.Print TheList.List(SaveList&)
  51.     Next SaveList&
  52.  
  53.     Printer.EndDoc
  54. End Sub
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.